﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ProgNetComponents.Design.Attributes;
using System.ComponentModel;
using DevExpress.Utils.Editors;
using System.Drawing.Design;
using ProgNetDxComponents.Design.Editors;

namespace ProgNetDxComponents.ExtenderProviders.Options
{
    public class Option : ProgNetComponents.Components.CustomTypeDescriptorObject, ProgNetComponents.NamedObjects.INamedObject
    {
        private object _DefaultValue;
        #region INamedObject Members

        public string Name
        {
            get;
            set;
        }

        #endregion

        [Editor(typeof(UIObjectEditor), typeof(UITypeEditor)),
        RefreshProperties(System.ComponentModel.RefreshProperties.All)]
        public object DefaultValue
        {
            get { return _DefaultValue; }
            set
            {
                _DefaultValue = value;
                if (value != null)
                {
                    OptionType = value.GetType();
                }
            }
        }

        [DynamicBrowsableByProperty("DefaultValue", null),
        Editor(typeof(OptionTypeEditor), typeof(UITypeEditor))]
        public Type OptionType
        {
            get;
            set;
        }

        public bool Encrypt
        {
            get;
            set;
        }
    }
}
